<template>
  <div class="container">
    <div class="container-top">
      <div class="top-name">内容管理</div>
    </div>
    <div class="input_modal">
      <div  style="padding: 8px 12px 12px;">
        <el-tabs
          v-model="activeName2"
          type="card"
          @tab-click="handleClickTab"
        >
          <el-tab-pane
            label="联系客服"
            name="1"
          ></el-tab-pane>
          <el-tab-pane
            label="关于我们"
            name="2"
          ></el-tab-pane>
          <el-tab-pane
            label="注册协议"
            name="3"
          ></el-tab-pane>
          <el-tab-pane
            label="功能介绍"
            name="4"
          ></el-tab-pane>
        </el-tabs>
      </div>
    </div>
 
    <div class="info-wrap">
      <div class="info"></div>
      <div class="edit">
        <el-form
          :model="information"
          :rules="rules"
          ref="information"
          label-width="180px"
          class=""
        >
          <el-form-item
            label="手机号"
            prop="mobile"
          >
            <el-input
              style="width:400px"
              v-model="information.mobile"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
          <el-form-item
            label="qq"
            prop="qq"
          >
            <el-input
              style="width:400px"
              v-model="information.qq"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
          <el-form-item
            label="微信"
            prop="weChat"
          >
            <el-input
              style="width:400px"
              v-model="information.weChat"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
          <el-form-item>
            <el-button
              type="primary"
              @click="handleSaveBanner('information')"
              :loading="loading"
            >保存</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
let CONSTANT = require("../../constant/constant.js");
let common = require("../../common.js");
export default {
  data() {
    return {
      activeName2: "1",
      information: {
        mobile: "",
        qq:'',
        weChat:''
      },
      loading: false,
      rules: {}
    };
  },
  mounted() {
    this.getInfo();
  },
  methods: {
    getInfo: function() {
      let url = CONSTANT.URL.LIST.findContact;
      common.get(url, '', res => {
        let arr = res.data.bussData;
        if(!arr.mobile&&!arr.qq&&!arr.weChat){
           this.information =  {
                mobile: "",
                qq:'',
                weChat:''
            }
        }else{
            this.information = arr
        }
       
      });
    },
    handleClickTab(tab, e) {
      if (tab.name == '1') {
        this.$router.push('/contentAd')
      } else if (tab.name == '2') {
        this.$router.push('/aboutUs')
      } else if (tab.name == '3') {
        this.$router.push('/registerText')
      } else if (tab.name == '4') {
        this.$router.push('/introduce')
      }
    },
    handleSaveBanner() {
      let url = CONSTANT.URL.LIST.saveContact
      common.post(url, this.information, (res) => {
        this.$message({
          type: "success",
          message: "保存成功!"
        });
      })
    }
  },
};
</script>
<style lang="scss">
.info-wrap {
  background-color: #fff;
  min-height: 100px;
  margin-top: 10px;
  padding: 20px 0;
}
</style>


